package com.struts.deal.job;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.lg.system.CConstants;
import com.lg.system.CDealException;
import com.lg.system.CPageDeal;
import com.lg.system.CSqlMap;
import com.lg.system.CTurnPage;
import com.struts.web.job.ViewJobForm;

public class Deal {


	/**
	 * 普通搜索
	 * @param request
	 * @param aWebForm
	 * @throws CDealException
	 */
	public static void viewJob(HttpServletRequest request,ViewJobForm  aWebForm) throws
	CDealException{
		CTurnPage page = new CTurnPage();
		try{
			if(aWebForm.getSubStation().equals("#")){
				aWebForm.setSubStation(""); 
			}
			page.setQueryList("T_CORPORATION.serchForPosition",aWebForm);
			page.setPerPageRows(10);
			page.excute(request);
			request.setAttribute("page", page);
		} catch (Exception e) {
			throw new CDealException("根据输入条件进行查询时失败。", e);
		}
	}

	/**
	 *热门搜索
	 * @param request
	 * @param aWebForm
	 * @throws CDealException
	 */
	public static void viewHopJob(HttpServletRequest request) throws
	CDealException{
		CTurnPage page = new CTurnPage();
		String staId=request.getParameter("staId");
		try{
			page.setQueryList("T_CORPORATION.selectHopPosition",staId);
			page.setPerPageRows(10);
			page.excute(request);
			request.setAttribute("page", page);
		} catch (Exception e) {
			throw new CDealException("根据输入条件进行查询时失败。", e);
		}
	}


	/**
	 * 列出热门搜索的所有关键词
	 */
	public static void hopSearchView(HttpServletRequest request){
		try{
			SqlMapClient sqlmap=CSqlMap.getSqlMapConfig();
			System.out.println("hopserach:");
			List hopSearchList = null;//6热门搜索
			hopSearchList = sqlmap.queryForList("T_HOP_SEARCH.selectForHop");
			if(hopSearchList!=null)request.setAttribute("hopsearchlist", hopSearchList);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
